package com.yingli.network;

import android.os.Bundle;
import android.view.MenuItem;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.google.android.material.bottomnavigation.BottomNavigationView;

public class BottomNavigationActivity extends AppCompatActivity {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_bottomnavigation);//指定xml文件
        //指定id BottomNavigationView:是视图
        BottomNavigationView bottom = findViewById(R.id.bottom_menu);
        bottom.setItemIconTintList(null);
        bottom.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
            @Override
            public boolean onNavigationItemSelected(@NonNull MenuItem item) {
                int itemId = item.getItemId();
                switch (itemId){
                    case R.id.a1:
                        Toast.makeText(BottomNavigationActivity.this, "圈子", Toast.LENGTH_SHORT).show();
                        break;
                    case R.id.a2:
                        Toast.makeText(BottomNavigationActivity.this, "画板", Toast.LENGTH_SHORT).show();
                        break;
                    case R.id.a3:
                        Toast.makeText(BottomNavigationActivity.this, "信息", Toast.LENGTH_SHORT).show();
                        break;
                    case R.id.a4:
                        Toast.makeText(BottomNavigationActivity.this, "我的", Toast.LENGTH_SHORT).show();
                        break;
                }
                return true;
            }
        });
    }
}
